/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.genexus.search;

import java.util.HashMap;
import org.apache.lucene.search.Query;

/**
 *
 * @author Emiliano
 */
public class QueriesMap {

    private static QueriesMap m_instance = new QueriesMap();
    public static QueriesMap getInstance(){return m_instance;}

    static HashMap queries = new HashMap(Integer.MAX_VALUE/1000);

    public void addQuery(String query, Query q){
        if (queries.size() == Integer.MAX_VALUE/2000){
            queries.clear();
        }
        queries.put(query, q);
    }

    public Query getQuery(String query){
        return (Query)queries.get(query);
    }

    public void flushQueries(){
        queries = new HashMap();
    }
}
